<?php include ($_SERVER ["DOCUMENT_ROOT"] . "/lib/module/conn_db.php");?>
<?php include ($_SERVER ["DOCUMENT_ROOT"] . "/lib/module/Util.php");?>
<?php //DB Open

	$result = null;
	$db = new MyDB ( false );
	$db->err_report = true;

?>
<?php

	$util = new Util();

	$sid = $_GET['sid'];

	if(!$sid) echo "<script>alert('잘못되 경로입니다.');location.back();</script>";

	$where = "where category_sid=".$sid;

	$sql = "select X.sub_name, X.sub_hanja, X.sub_hanja ,X.sub_history, Y.category_name, Y.category_hanja from (SELECT category_name as sub_name, category_parent as sub_parent, category_hanja as sub_hanja, category_history2 as sub_history from tb_category ".$where." ) X inner JOIN tb_category Y on X.sub_parent=Y.category_sid";
	$db->query ( $sql );
	$query = $db->result;
	$total = mysql_num_rows ($query);
	if($total>0) $root = mysql_fetch_object($query);

?>
<?php //DB Close

	$db->close ();

?>
<?php include "inc/inc_header.php" ?><!-- header -->
<script type="text/javascript">

function category(fm,id)
		{
			var obj = document.category_write_frm;
			if(id==1){
				//alert('111');
				fm.last_name.value = "";
				fm.home.value = "";
			}
			if(id==2){
				fm.home.value = "";
				//$('#category_write').show();
			}
			if(id==3){
				var id_value = fm.home.value;
				var initial_v = fm.initial.value;
				var last_name_v = fm.last_name.value;

				//alert(id_value);
				document.location.href="surn01_01.php?sid="+id_value+"&initial_v="+initial_v+"&last_name_v="+last_name_v;
			}


			fm.submit();
		}
		function receive(data,msg)
		{
			//alert(msg);
			$("#last_name").html(data);
			$("#home").html(msg);
		}


	function popup(url,width,height) {
		window.open(url,"","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,left=0, top=0, resizable=no,width=" + width + "px,height=" + height + "px");
	}
	function go(obj,tap){
		var fm = document.frm;
		var bg = document.getElementById("tap"+tap);
		var txt = tap+1;
		//alert(tap);
		if (tap != "7" && tap != "6") {
			$("#modi").html("<strong>■ 수정할 부분이나 추가 등재를 원하시면(개인 또는 문중) 본사 상담센터로 연락 주시거나 질의 및 답변을 이용해주시기 바랍니다. ■</strong>");
		}else {
			$("#modi").html("&nbsp;");
		}

        $("#player").html(changeSwf(tap+1));

		if(obj!=""){

			fm.action = obj.getAttribute('href');
			fm.submit();

			for(i=1; i<=8; i++){
                document.getElementById("tap"+i).setAttribute('background',"img/surn/tap_bg01.jpg")
			}
            bg.setAttribute('background',"img/surn/tap_bg01on.jpg")

		}
		return false;

	}
	//<![CDATA[
	function resize(id)

	{
		//alert(id);
		var obj = (typeof(id)=='string')?document.getElementById(id):id;
		obj.height = obj.contentWindow.document.body.scrollHeight+50;

	}

	function doResize(id)

	{

		setTimeout("resize('"+id+"')",100);

	}


	//]]>
</script>
<?php $title = "성씨별 총람"; $sub_title="성씨별 총람";?>
<body style="background-repeat: repeat-x; overflow-x:hidden;" >
	<?php $txt=2;?>
	<?php include "inc/inc_top.php" ?><!-- top -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td style="BACKGROUND-IMAGE: url(img/surn/cont_bg04.jpg); BACKGROUND-REPEAT: repeat-x; BACKGROUND-position:right top;">&nbsp;</td>
		<td width="994" align="right" style="BACKGROUND-IMAGE: url(img/surn/cont_bg06.jpg); BACKGROUND-REPEAT: repeat-x; BACKGROUND-position:center top;padding-bottom:16px;"><table width="954" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td><table width="954">
			  <tr>
				<td style="padding-bottom:10px;">
				<table width="954" bgcolor="#424242">
				  <tr>
					<td bgcolor="#585858" style="height:40px;padding:10px 14px 0 14px;text-align:left;border-bottom:1px solid #333;">
					<iframe id="CateFrm" name="CateFrm" style="display:none"></iframe>
					<form name="CateFm" method="post" action="category_view_frm.php" target="CateFrm">
					<table cellpadding="0" cellspacing="0" border="0">
						<tbody>
							<tr>
								<td class="text03">
									초성 :
										<select id="initial" name="initial" onChange="return category(document.CateFm,1);">
											<option value="0">선택</option>
											<option value="1">ㄱ</option>
											<option value="2">ㄴ</option>
											<option value="3">ㄷ</option>
											<option value="4">ㄹ</option>
											<option value="5">ㅁ</option>
											<option value="6">ㅂ</option>
											<option value="7">ㅅ</option>
											<option value="8">ㅇ</option>
											<option value="9">ㅈ</option>
											<option value="10">ㅊ</option>
											<option value="11">ㅋ</option>
											<option value="12">ㅌ</option>
											<option value="13">ㅍ</option>
											<option value="14">ㅎ</option>
										</select>


									성씨 :
										<select id="last_name" name="last_name" onChange="return category(document.CateFm,2);">
											<option value=''>선택</option>
										</select>

									본관 :
										<select id="home" name="home" onChange="return category(document.CateFm,3);">
											<option value=''>선택</option>
										</select>


										<?php if(isset($initial_v) && $initial_v){?>
										<script type="text/javascript">
										<!--
											//document.CateFm.initial.value=<?=$initial_v?>;
											//category(document.CateFm,1);
											//document.CateFm.last_name.value='<?=$last_name_v?>';
											//category(document.CateFm,2);
										//-->
										</script>
										<?php } ?>
								</td>
							</tr>
						</tbody>
					</table>
				</form>


					</td>
				  </tr>

				  <tr>
					<td height="40" bgcolor="#585858" style="padding:0 14px 0 14px;text-align:left">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						  <td class="text03"><strong>선택하신 성씨 : <?php echo $root->category_name;?>(<?php echo $root->category_hanja;?>) / <?php echo $root->sub_name;?>(<?php echo $root->sub_hanja;?>)</strong></td>
						  <td align="right"><a href="surn01.php"><img src="img/surn/cont_btn01.jpg" width="110" height="22" border="0"></a></td>
						</tr>
					</table>
					</td>
				  </tr>
				</table></td>
			  </tr>
			  <tr>
				<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tr>
					<td style="padding-bottom:20px;"><table class="frames_box">
						<tr>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
							  <?php if(isset($sample) && $sample=="Y"){ ?>
								<td align="center" id="tap1" background="img/surn/tap_bg01.jpg" class="text05"><a href="surn01_01_0.php" onClick="return go(this,1); return false;"><strong>가문의 유래</strong></a></td>
							  <?php }else{ ?>
								<td align="center" id="tap1" background="img/surn/tap_bg01on.jpg" class="text05"><a href="surn01_01_0.php" onClick="return go(this,1); return false;"><strong>가문의 유래</strong></a></td>
							  <?php } ?>
							  </tr>
						  </table></td>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap2" background="img/surn/tap_bg01.jpg" class="text05"><a href="surn01_01_1.php" onClick="return go(this,2); return false;"><strong>역대인물</strong></a></td>
							  </tr>
						  </table></td>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap3" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="surn01_01_2.php" onClick="return go(this,3); return false;">유적화보편</a></strong></td>
							  </tr>
						  </table></td>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap4" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="surn01_01_3.php" onClick="return go(this,4); return false;">항렬표</a></strong></td>
							  </tr>
						  </table></td>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap5" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="surn01_01_4.php" onClick="return go(this,5); return false;">분파도</a></strong></td>
							  </tr>
						  </table></td>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap6" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="surn01_01_5.php" onClick="return go(this,6); return false;">현대인물</a></strong></td>
							  </tr>
						  </table></td>
						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap7" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="surn01_01_6.php" onClick="return go(this,7); return false;">일가장터</a></strong></td>
							  </tr>
						  </table></td>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="pa.php" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <!--<?php if($sid==1204){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/1204.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else if($sid==749){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/749.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else if($sid==957){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/957.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						   <?php }else if($sid==829){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/829.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else if($sid==1143){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/1143.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else if($sid==1144){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/1144.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else if($sid==319){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/319.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else if($sid==1054){ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/_jokbo/1054.htm" onClick="return go(this,8); return false;">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php }else{ ?>

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="javascript:alert('준비중입니다.');">인터넷족보</a></strong></td>
							  </tr>
						  </table></td>

						  <?php } ?>-->

						  <td style="padding-right:8px;"><table width="94" height="26">
							  <tr>
								<td align="center" id="tap8" background="img/surn/tap_bg01.jpg" class="text05"><strong><a href="/free01.php?category_sid=<?=$sid?>">게시판</a></strong></td>
							  </tr>
						  </table></td>

						</tr>
					</table></td>
				  </tr>

				  <tr>
					<td height="200" style="padding-bottom:20px;">
						<form id="frm" name="frm" method="get" target="pro_list">
							<input type="hidden" name="sid" value="<?php echo $sid;?>">
						</form>
						<iframe src="surn01_01_0.php?sid=<?php echo $sid;?>" name="pro_list" id="pro_list" marginwidth=0 marginheight=0 height=0 width="100%" scrolling=no border=0 frameborder=0 allowTransparency="true" onload='doResize(this.id)'></iframe>
					</td>
				  </tr>
				</table></td>
			  </tr>
			</table></td>
		  </tr>
		</table></td>
		<td style="BACKGROUND-IMAGE: url(img/surn/cont_bg05.jpg); BACKGROUND-REPEAT: repeat-x; BACKGROUND-position:left top;">&nbsp;</td>
	  </tr>
	</table>
	<?php include "inc/inc_bottom.php" ?><!-- bottom -->
<?php include "inc/inc_footer.php" ?><!-- footer -->
